Skip to contentSkip to conversation

Change in openvpn[master]: Remove openssl engine method for loading the key

Openvpn-devel plaisthos (Code Review) 1 participant 6 messages Oct 18, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1697629414000.I2d353a0cea0a62f289b8c1060244df66dd7a14cb@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/373?usp=email

to review the following change.

Change subject: Remove openssl engine method for loading the key
......................................................................

Remove openssl engine method for loading the key

This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomlehy has not agreed to the proposed license chagne. He is also okay with removing with the feature from the current code base as it is obsolete with OpenSSL 3.0.

Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
---
M .gitignore
M configure.ac
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
M src/openvpn/ssl_openssl.c
M tests/unit_tests/Makefile.am
D tests/unit_tests/engine-key/Makefile.am
D tests/unit_tests/engine-key/check_engine_keys.sh D tests/unit_tests/engine-key/libtestengine.c D tests/unit_tests/engine-key/openssl.cnf.in

10 files changed, 0 insertions(+), 279 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/73/373/1

.gitignore +0 -4
index ed03aaa..a1da366 100644
@@ -57,10 +57,6 @@
 t_client.rc
 t_client_ips.rc
 tests/unit_tests/**/*_testdriver
-tests/unit_tests/engine-key/client.key
-tests/unit_tests/engine-key/log.txt
-tests/unit_tests/engine-key/openssl.cnf
-tests/unit_tests/engine-key/passwd
 
 src/openvpn/openvpn
 include/openvpn-plugin.h
configure.ac +0 -1
index 266b66f..128ab86 100644
@@ -1532,7 +1532,6 @@
         tests/unit_tests/openvpn/Makefile
         tests/unit_tests/plugins/Makefile
         tests/unit_tests/plugins/auth-pam/Makefile
-	tests/unit_tests/engine-key/Makefile
 	sample/Makefile
 ])
 AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])
src/openvpn/crypto_openssl.c +0 -60

66 lines not on this page · raw message

src/openvpn/crypto_openssl.h +0 -12
index 32849fd..c5a5393 100644
@@ -118,16 +118,4 @@
         msg((flags), __VA_ARGS__); \
     } while (false)
 
-/**
- * Load a key file from an engine
- *
- * @param file  The engine file to load
- * @param ui    The UI method for the password prompt
- * @param data  The data to pass to the UI method
- *
- * @return      The private key if successful or NULL if not
- */
-EVP_PKEY *
-engine_load_key(const char *file, SSL_CTX *ctx);
-
 #endif /* CRYPTO_OPENSSL_H_ */
src/openvpn/ssl_openssl.c +0 -4
index 4c08add..23e7623 100644
@@ -1057,10 +1057,6 @@
     pkey = PEM_read_bio_PrivateKey(in, NULL,
                                    SSL_CTX_get_default_passwd_cb(ctx->ctx),
                                    SSL_CTX_get_default_passwd_cb_userdata(ctx->ctx));
-    if (!pkey)
-    {
-        pkey = engine_load_key(priv_key_file, ctx->ctx);
-    }
 
     if (!pkey || !SSL_CTX_use_PrivateKey(ssl_ctx, pkey))
     {
tests/unit_tests/Makefile.am +0 -3
index f27cd90..33fefaa 100644
@@ -2,7 +2,4 @@
 
 if ENABLE_UNITTESTS
 SUBDIRS = example_test openvpn plugins
-if OPENSSL_ENGINE
-SUBDIRS += engine-key
-endif
 endif
tests/unit_tests/engine-key/Makefile.am deleted +0 -31
deleted file mode 100644
index 0c28885..0000000
@@ -1,31 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-
-check_LTLIBRARIES = libtestengine.la
-conffiles = openssl.cnf
-EXTRA_DIST = \
-	openssl.cnf.in \
-	check_engine_keys.sh
-
-TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
-	builddir="$(abs_builddir)"; \
-	top_builddir="$(top_builddir)"; \
-	top_srcdir="$(top_srcdir)"; \
-	export srcdir builddir top_builddir top_srcdir;
-
-if !CROSS_COMPILING
-TESTS = check_engine_keys.sh
-endif
-check_engine_keys.sh: $(conffiles)
-
-CLEANFILES = \
-	client.key \
-	passwd \
-	log.txt \
-	$(conffiles)
-
-openssl.cnf: $(srcdir)/openssl.cnf.in
-	sed "s|ABSBUILDDIR|$(abs_builddir)|" < $(srcdir)/openssl.cnf.in > $@
-
-libtestengine_la_SOURCES = libtestengine.c
-libtestengine_la_LDFLAGS = @TEST_LDFLAGS@ -rpath /lib -shrext .so
-libtestengine_la_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir)
tests/unit_tests/engine-key/check_engine_keys.sh deleted +0 -36
deleted file mode 100755
index 12dd230..0000000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-OPENSSL_CONF="${builddir}/openssl.cnf"
-export OPENSSL_CONF
-
-password='AT3S4PASSWD'
-
-key="${builddir}/client.key"
-pwdfile="${builddir}/passwd"
-
-# create an engine key for us
-sed 's/PRIVATE KEY/TEST ENGINE KEY/' < ${top_srcdir}/sample/sample-keys/client.key > ${key}
-echo "$password" > $pwdfile
-
-# our version of grep to output log.txt on failure in case it's an openssl
-# error mismatch and the grep expression needs updating
-loggrep() {
-    egrep -q "$1" log.txt || { echo '---- begin log.txt ----'; cat log.txt; echo '--- end log.txt ---'; return 1; }
-}
-
-# note here we've induced a mismatch in the client key and the server
-# cert which openvpn should report and die.  Check that it does.  Note
-# also that this mismatch depends on openssl not openvpn, so it is
-# somewhat fragile
-${top_builddir}/src/openvpn/openvpn --cd ${top_srcdir}/sample --config sample-config-files/loopback-server --engine testengine --key ${key} --askpass $pwdfile > log.txt 2>&1
-
-# first off check we died because of a key mismatch.  If this doesn't
-# pass, suspect openssl of returning different messages and update the
-# test accordingly
-loggrep '(x509 certificate routines:(X509_check_private_key)?:key values mismatch|func\(128\):reason\(116\))' log.txt || { echo "Key mismatch not detected"; exit 1; }
-
-# now look for the engine prints (these are under our control)
-loggrep 'ENGINE: engine_init called' || { echo "Engine initialization not detected"; exit 1; }
-loggrep 'ENGINE: engine_load_key called' || { echo "Key was not loaded from engine"; exit 1; }
-loggrep "ENGINE: engine_load_key got password ${password}" || { echo "Key password was not retrieved by the engine"; exit 1; }
-exit 0
tests/unit_tests/engine-key/libtestengine.c deleted +0 -116

116 lines not on this page · raw message

tests/unit_tests/engine-key/openssl.cnf.in deleted +0 -12
deleted file mode 100644
index 5eda9fa..0000000
@@ -1,12 +0,0 @@
-HOME		= .
-openssl_conf	= openssl_init
-
-[req]
-[openssl_init]
-engines		= engines_section
-
-[engines_section]
-testengine	= testengine_section
-
-[testengine_section]
-dynamic_path	= ABSBUILDDIR/.libs/libtestengine.so

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/373?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
Gerrit-Change-Number: 373
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/373?usp=email )

Change subject: Remove openssl engine method for loading the key
......................................................................

Patch Set 1: Code-Review-1

(5 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/373/comment/e17b8596_9a54a763 :
PS1, Line 10: deprecated since OpenSSL 3.0 and James Bottomlehy has not agreed "Bottomley"

http://gerrit.openvpn.net/c/openvpn/+/373/comment/95a52a7e_866bd6f6 :
PS1, Line 11: to the proposed license chagne. He is also okay with removing "change"

http://gerrit.openvpn.net/c/openvpn/+/373/comment/4669cbdb_a38c78ba :
PS1, Line 12: with the feature from the current code base as it is obsolete with remove "with"

http://gerrit.openvpn.net/c/openvpn/+/373/comment/bea8f16e_17b2230f :
PS1, Line 14:
I think the commit message should mention the original commit that introduced the feature.

Patchset:

PS1:
Commit message needs some work.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/373?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
Gerrit-Change-Number: 373
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Oct 2023 12:50:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/373?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld

Change subject: Remove openssl engine method for loading the key
......................................................................

Remove openssl engine method for loading the key

This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomley has not agreed to the proposed license change. He is also okay removing with the feature from the current code base as it is obsolete with OpenSSL 3.0.

The main commits that are reverted by this commit are 8155f8aa0 and 542c69c37 (unit test)

Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
---
M .gitignore
M configure.ac
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
M src/openvpn/ssl_openssl.c
M tests/unit_tests/Makefile.am
D tests/unit_tests/engine-key/Makefile.am
D tests/unit_tests/engine-key/check_engine_keys.sh D tests/unit_tests/engine-key/libtestengine.c D tests/unit_tests/engine-key/openssl.cnf.in

10 files changed, 0 insertions(+), 279 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/73/373/2

.gitignore +0 -4
index ed03aaa..a1da366 100644
@@ -57,10 +57,6 @@
 t_client.rc
 t_client_ips.rc
 tests/unit_tests/**/*_testdriver
-tests/unit_tests/engine-key/client.key
-tests/unit_tests/engine-key/log.txt
-tests/unit_tests/engine-key/openssl.cnf
-tests/unit_tests/engine-key/passwd
 
 src/openvpn/openvpn
 include/openvpn-plugin.h
configure.ac +0 -1
index 266b66f..128ab86 100644
@@ -1532,7 +1532,6 @@
         tests/unit_tests/openvpn/Makefile
         tests/unit_tests/plugins/Makefile
         tests/unit_tests/plugins/auth-pam/Makefile
-	tests/unit_tests/engine-key/Makefile
 	sample/Makefile
 ])
 AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])
src/openvpn/crypto_openssl.c +0 -60

66 lines not on this page · raw message

src/openvpn/crypto_openssl.h +0 -12
index 32849fd..c5a5393 100644
@@ -118,16 +118,4 @@
         msg((flags), __VA_ARGS__); \
     } while (false)
 
-/**
- * Load a key file from an engine
- *
- * @param file  The engine file to load
- * @param ui    The UI method for the password prompt
- * @param data  The data to pass to the UI method
- *
- * @return      The private key if successful or NULL if not
- */
-EVP_PKEY *
-engine_load_key(const char *file, SSL_CTX *ctx);
-
 #endif /* CRYPTO_OPENSSL_H_ */
src/openvpn/ssl_openssl.c +0 -4
index 4c08add..23e7623 100644
@@ -1057,10 +1057,6 @@
     pkey = PEM_read_bio_PrivateKey(in, NULL,
                                    SSL_CTX_get_default_passwd_cb(ctx->ctx),
                                    SSL_CTX_get_default_passwd_cb_userdata(ctx->ctx));
-    if (!pkey)
-    {
-        pkey = engine_load_key(priv_key_file, ctx->ctx);
-    }
 
     if (!pkey || !SSL_CTX_use_PrivateKey(ssl_ctx, pkey))
     {
tests/unit_tests/Makefile.am +0 -3
index f27cd90..33fefaa 100644
@@ -2,7 +2,4 @@
 
 if ENABLE_UNITTESTS
 SUBDIRS = example_test openvpn plugins
-if OPENSSL_ENGINE
-SUBDIRS += engine-key
-endif
 endif
tests/unit_tests/engine-key/Makefile.am deleted +0 -31
deleted file mode 100644
index 0c28885..0000000
@@ -1,31 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-
-check_LTLIBRARIES = libtestengine.la
-conffiles = openssl.cnf
-EXTRA_DIST = \
-	openssl.cnf.in \
-	check_engine_keys.sh
-
-TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
-	builddir="$(abs_builddir)"; \
-	top_builddir="$(top_builddir)"; \
-	top_srcdir="$(top_srcdir)"; \
-	export srcdir builddir top_builddir top_srcdir;
-
-if !CROSS_COMPILING
-TESTS = check_engine_keys.sh
-endif
-check_engine_keys.sh: $(conffiles)
-
-CLEANFILES = \
-	client.key \
-	passwd \
-	log.txt \
-	$(conffiles)
-
-openssl.cnf: $(srcdir)/openssl.cnf.in
-	sed "s|ABSBUILDDIR|$(abs_builddir)|" < $(srcdir)/openssl.cnf.in > $@
-
-libtestengine_la_SOURCES = libtestengine.c
-libtestengine_la_LDFLAGS = @TEST_LDFLAGS@ -rpath /lib -shrext .so
-libtestengine_la_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir)
tests/unit_tests/engine-key/check_engine_keys.sh deleted +0 -36
deleted file mode 100755
index 12dd230..0000000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-OPENSSL_CONF="${builddir}/openssl.cnf"
-export OPENSSL_CONF
-
-password='AT3S4PASSWD'
-
-key="${builddir}/client.key"
-pwdfile="${builddir}/passwd"
-
-# create an engine key for us
-sed 's/PRIVATE KEY/TEST ENGINE KEY/' < ${top_srcdir}/sample/sample-keys/client.key > ${key}
-echo "$password" > $pwdfile
-
-# our version of grep to output log.txt on failure in case it's an openssl
-# error mismatch and the grep expression needs updating
-loggrep() {
-    egrep -q "$1" log.txt || { echo '---- begin log.txt ----'; cat log.txt; echo '--- end log.txt ---'; return 1; }
-}
-
-# note here we've induced a mismatch in the client key and the server
-# cert which openvpn should report and die.  Check that it does.  Note
-# also that this mismatch depends on openssl not openvpn, so it is
-# somewhat fragile
-${top_builddir}/src/openvpn/openvpn --cd ${top_srcdir}/sample --config sample-config-files/loopback-server --engine testengine --key ${key} --askpass $pwdfile > log.txt 2>&1
-
-# first off check we died because of a key mismatch.  If this doesn't
-# pass, suspect openssl of returning different messages and update the
-# test accordingly
-loggrep '(x509 certificate routines:(X509_check_private_key)?:key values mismatch|func\(128\):reason\(116\))' log.txt || { echo "Key mismatch not detected"; exit 1; }
-
-# now look for the engine prints (these are under our control)
-loggrep 'ENGINE: engine_init called' || { echo "Engine initialization not detected"; exit 1; }
-loggrep 'ENGINE: engine_load_key called' || { echo "Key was not loaded from engine"; exit 1; }
-loggrep "ENGINE: engine_load_key got password ${password}" || { echo "Key password was not retrieved by the engine"; exit 1; }
-exit 0
tests/unit_tests/engine-key/libtestengine.c deleted +0 -116

116 lines not on this page · raw message

tests/unit_tests/engine-key/openssl.cnf.in deleted +0 -12
deleted file mode 100644
index 5eda9fa..0000000
@@ -1,12 +0,0 @@
-HOME		= .
-openssl_conf	= openssl_init
-
-[req]
-[openssl_init]
-engines		= engines_section
-
-[engines_section]
-testengine	= testengine_section
-
-[testengine_section]
-dynamic_path	= ABSBUILDDIR/.libs/libtestengine.so

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/373?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
Gerrit-Change-Number: 373
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/373?usp=email )

Change subject: Remove openssl engine method for loading the key
......................................................................

Patch Set 1:

(4 comments)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/373/comment/0149c5eb_55c90e09 :
PS1, Line 10: deprecated since OpenSSL 3.0 and James Bottomlehy has not agreed

Quoted 1 line

"Bottomley"

Done

http://gerrit.openvpn.net/c/openvpn/+/373/comment/af84499a_816aed3b :
PS1, Line 11: to the proposed license chagne. He is also okay with removing

Quoted 1 line

"change"

Done

http://gerrit.openvpn.net/c/openvpn/+/373/comment/63ad92ba_355c5268 :
PS1, Line 12: with the feature from the current code base as it is obsolete with

Quoted 1 line

remove "with"

Done

http://gerrit.openvpn.net/c/openvpn/+/373/comment/1342b05c_74711bb4 :
PS1, Line 14:

Quoted 1 line

I think the commit message should mention the original commit that introduced the feature.

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/373?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
Gerrit-Change-Number: 373
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 18 Oct 2023 13:21:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#3) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/373?usp=email )

Change subject: Remove openssl engine method for loading the key
......................................................................

Remove openssl engine method for loading the key

This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomley has not agreed to the proposed license chagne. He is also okay with removing the feature from the current code base as it is obsolete with OpenSSL 3.0.

The original commit ID was a0a8d801dd0d84e0ec844b9ca4c225df7 (plus subsequent fixes).

Change-Id I2d353a0cea0a62f289b8c1060244df66dd7a14cb

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27133.html

---
M .gitignore
M configure.ac
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
M src/openvpn/ssl_openssl.c
M tests/unit_tests/Makefile.am
D tests/unit_tests/engine-key/Makefile.am D tests/unit_tests/engine-key/check_engine_keys.sh D tests/unit_tests/engine-key/libtestengine.c D tests/unit_tests/engine-key/openssl.cnf.in

10 files changed, 0 insertions(+), 279 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/73/373/3

.gitignore +0 -4
index ed03aaa..a1da366 100644
@@ -57,10 +57,6 @@
 t_client.rc
 t_client_ips.rc
 tests/unit_tests/**/*_testdriver
-tests/unit_tests/engine-key/client.key
-tests/unit_tests/engine-key/log.txt
-tests/unit_tests/engine-key/openssl.cnf
-tests/unit_tests/engine-key/passwd
 
 src/openvpn/openvpn
 include/openvpn-plugin.h
configure.ac +0 -1
index 266b66f..128ab86 100644
@@ -1532,7 +1532,6 @@
         tests/unit_tests/openvpn/Makefile
         tests/unit_tests/plugins/Makefile
         tests/unit_tests/plugins/auth-pam/Makefile
-	tests/unit_tests/engine-key/Makefile
 	sample/Makefile
 ])
 AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])
src/openvpn/crypto_openssl.c +0 -60

66 lines not on this page · raw message

src/openvpn/crypto_openssl.h +0 -12
index 32849fd..c5a5393 100644
@@ -118,16 +118,4 @@
         msg((flags), __VA_ARGS__); \
     } while (false)
 
-/**
- * Load a key file from an engine
- *
- * @param file  The engine file to load
- * @param ui    The UI method for the password prompt
- * @param data  The data to pass to the UI method
- *
- * @return      The private key if successful or NULL if not
- */
-EVP_PKEY *
-engine_load_key(const char *file, SSL_CTX *ctx);
-
 #endif /* CRYPTO_OPENSSL_H_ */
src/openvpn/ssl_openssl.c +0 -4
index 4c08add..23e7623 100644
@@ -1057,10 +1057,6 @@
     pkey = PEM_read_bio_PrivateKey(in, NULL,
                                    SSL_CTX_get_default_passwd_cb(ctx->ctx),
                                    SSL_CTX_get_default_passwd_cb_userdata(ctx->ctx));
-    if (!pkey)
-    {
-        pkey = engine_load_key(priv_key_file, ctx->ctx);
-    }
 
     if (!pkey || !SSL_CTX_use_PrivateKey(ssl_ctx, pkey))
     {
tests/unit_tests/Makefile.am +0 -3
index f27cd90..33fefaa 100644
@@ -2,7 +2,4 @@
 
 if ENABLE_UNITTESTS
 SUBDIRS = example_test openvpn plugins
-if OPENSSL_ENGINE
-SUBDIRS += engine-key
-endif
 endif
tests/unit_tests/engine-key/Makefile.am deleted +0 -31
deleted file mode 100644
index 0c28885..0000000
@@ -1,31 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-
-check_LTLIBRARIES = libtestengine.la
-conffiles = openssl.cnf
-EXTRA_DIST = \
-	openssl.cnf.in \
-	check_engine_keys.sh
-
-TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
-	builddir="$(abs_builddir)"; \
-	top_builddir="$(top_builddir)"; \
-	top_srcdir="$(top_srcdir)"; \
-	export srcdir builddir top_builddir top_srcdir;
-
-if !CROSS_COMPILING
-TESTS = check_engine_keys.sh
-endif
-check_engine_keys.sh: $(conffiles)
-
-CLEANFILES = \
-	client.key \
-	passwd \
-	log.txt \
-	$(conffiles)
-
-openssl.cnf: $(srcdir)/openssl.cnf.in
-	sed "s|ABSBUILDDIR|$(abs_builddir)|" < $(srcdir)/openssl.cnf.in > $@
-
-libtestengine_la_SOURCES = libtestengine.c
-libtestengine_la_LDFLAGS = @TEST_LDFLAGS@ -rpath /lib -shrext .so
-libtestengine_la_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir)
tests/unit_tests/engine-key/check_engine_keys.sh deleted +0 -36
deleted file mode 100755
index 12dd230..0000000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-OPENSSL_CONF="${builddir}/openssl.cnf"
-export OPENSSL_CONF
-
-password='AT3S4PASSWD'
-
-key="${builddir}/client.key"
-pwdfile="${builddir}/passwd"
-
-# create an engine key for us
-sed 's/PRIVATE KEY/TEST ENGINE KEY/' < ${top_srcdir}/sample/sample-keys/client.key > ${key}
-echo "$password" > $pwdfile
-
-# our version of grep to output log.txt on failure in case it's an openssl
-# error mismatch and the grep expression needs updating
-loggrep() {
-    egrep -q "$1" log.txt || { echo '---- begin log.txt ----'; cat log.txt; echo '--- end log.txt ---'; return 1; }
-}
-
-# note here we've induced a mismatch in the client key and the server
-# cert which openvpn should report and die.  Check that it does.  Note
-# also that this mismatch depends on openssl not openvpn, so it is
-# somewhat fragile
-${top_builddir}/src/openvpn/openvpn --cd ${top_srcdir}/sample --config sample-config-files/loopback-server --engine testengine --key ${key} --askpass $pwdfile > log.txt 2>&1
-
-# first off check we died because of a key mismatch.  If this doesn't
-# pass, suspect openssl of returning different messages and update the
-# test accordingly
-loggrep '(x509 certificate routines:(X509_check_private_key)?:key values mismatch|func\(128\):reason\(116\))' log.txt || { echo "Key mismatch not detected"; exit 1; }
-
-# now look for the engine prints (these are under our control)
-loggrep 'ENGINE: engine_init called' || { echo "Engine initialization not detected"; exit 1; }
-loggrep 'ENGINE: engine_load_key called' || { echo "Key was not loaded from engine"; exit 1; }
-loggrep "ENGINE: engine_load_key got password ${password}" || { echo "Key password was not retrieved by the engine"; exit 1; }
-exit 0
tests/unit_tests/engine-key/libtestengine.c deleted +0 -116

116 lines not on this page · raw message

tests/unit_tests/engine-key/openssl.cnf.in deleted +0 -12
deleted file mode 100644
index 5eda9fa..0000000
@@ -1,12 +0,0 @@
-HOME		= .
-openssl_conf	= openssl_init
-
-[req]
-[openssl_init]
-engines		= engines_section
-
-[engines_section]
-testengine	= testengine_section
-
-[testengine_section]
-dynamic_path	= ABSBUILDDIR/.libs/libtestengine.so

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/373?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
Gerrit-Change-Number: 373
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/373?usp=email )

Change subject: Remove openssl engine method for loading the key
......................................................................

Remove openssl engine method for loading the key

This is a contribution for loading engine key. OpenSSL engine is deprecated since OpenSSL 3.0 and James Bottomley has not agreed to the proposed license chagne. He is also okay with removing the feature from the current code base as it is obsolete with OpenSSL 3.0.

The original commit ID was a0a8d801dd0d84e0ec844b9ca4c225df7 (plus subsequent fixes).

Change-Id I2d353a0cea0a62f289b8c1060244df66dd7a14cb

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg27133.html

---
M .gitignore
M configure.ac
M src/openvpn/crypto_openssl.c
M src/openvpn/crypto_openssl.h
M src/openvpn/ssl_openssl.c
M tests/unit_tests/Makefile.am
D tests/unit_tests/engine-key/Makefile.am D tests/unit_tests/engine-key/check_engine_keys.sh D tests/unit_tests/engine-key/libtestengine.c D tests/unit_tests/engine-key/openssl.cnf.in

10 files changed, 0 insertions(+), 279 deletions(-)
.gitignore +0 -4
index ed03aaa..a1da366 100644
@@ -57,10 +57,6 @@
 t_client.rc
 t_client_ips.rc
 tests/unit_tests/**/*_testdriver
-tests/unit_tests/engine-key/client.key
-tests/unit_tests/engine-key/log.txt
-tests/unit_tests/engine-key/openssl.cnf
-tests/unit_tests/engine-key/passwd
 
 src/openvpn/openvpn
 include/openvpn-plugin.h
configure.ac +0 -1
index 266b66f..128ab86 100644
@@ -1532,7 +1532,6 @@
         tests/unit_tests/openvpn/Makefile
         tests/unit_tests/plugins/Makefile
         tests/unit_tests/plugins/auth-pam/Makefile
-	tests/unit_tests/engine-key/Makefile
 	sample/Makefile
 ])
 AC_CONFIG_FILES([tests/t_client.sh], [chmod +x tests/t_client.sh])
src/openvpn/crypto_openssl.c +0 -60

66 lines not on this page · raw message

src/openvpn/crypto_openssl.h +0 -12
index 32849fd..c5a5393 100644
@@ -118,16 +118,4 @@
         msg((flags), __VA_ARGS__); \
     } while (false)
 
-/**
- * Load a key file from an engine
- *
- * @param file  The engine file to load
- * @param ui    The UI method for the password prompt
- * @param data  The data to pass to the UI method
- *
- * @return      The private key if successful or NULL if not
- */
-EVP_PKEY *
-engine_load_key(const char *file, SSL_CTX *ctx);
-
 #endif /* CRYPTO_OPENSSL_H_ */
src/openvpn/ssl_openssl.c +0 -4
index 4c08add..23e7623 100644
@@ -1057,10 +1057,6 @@
     pkey = PEM_read_bio_PrivateKey(in, NULL,
                                    SSL_CTX_get_default_passwd_cb(ctx->ctx),
                                    SSL_CTX_get_default_passwd_cb_userdata(ctx->ctx));
-    if (!pkey)
-    {
-        pkey = engine_load_key(priv_key_file, ctx->ctx);
-    }
 
     if (!pkey || !SSL_CTX_use_PrivateKey(ssl_ctx, pkey))
     {
tests/unit_tests/Makefile.am +0 -3
index f27cd90..33fefaa 100644
@@ -2,7 +2,4 @@
 
 if ENABLE_UNITTESTS
 SUBDIRS = example_test openvpn plugins
-if OPENSSL_ENGINE
-SUBDIRS += engine-key
-endif
 endif
tests/unit_tests/engine-key/Makefile.am deleted +0 -31
deleted file mode 100644
index 0c28885..0000000
@@ -1,31 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-
-check_LTLIBRARIES = libtestengine.la
-conffiles = openssl.cnf
-EXTRA_DIST = \
-	openssl.cnf.in \
-	check_engine_keys.sh
-
-TESTS_ENVIRONMENT = srcdir="$(abs_srcdir)"; \
-	builddir="$(abs_builddir)"; \
-	top_builddir="$(top_builddir)"; \
-	top_srcdir="$(top_srcdir)"; \
-	export srcdir builddir top_builddir top_srcdir;
-
-if !CROSS_COMPILING
-TESTS = check_engine_keys.sh
-endif
-check_engine_keys.sh: $(conffiles)
-
-CLEANFILES = \
-	client.key \
-	passwd \
-	log.txt \
-	$(conffiles)
-
-openssl.cnf: $(srcdir)/openssl.cnf.in
-	sed "s|ABSBUILDDIR|$(abs_builddir)|" < $(srcdir)/openssl.cnf.in > $@
-
-libtestengine_la_SOURCES = libtestengine.c
-libtestengine_la_LDFLAGS = @TEST_LDFLAGS@ -rpath /lib -shrext .so
-libtestengine_la_CFLAGS = @TEST_CFLAGS@ -I$(openvpn_srcdir) -I$(compat_srcdir)
tests/unit_tests/engine-key/check_engine_keys.sh deleted +0 -36
deleted file mode 100755
index 12dd230..0000000
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-OPENSSL_CONF="${builddir}/openssl.cnf"
-export OPENSSL_CONF
-
-password='AT3S4PASSWD'
-
-key="${builddir}/client.key"
-pwdfile="${builddir}/passwd"
-
-# create an engine key for us
-sed 's/PRIVATE KEY/TEST ENGINE KEY/' < ${top_srcdir}/sample/sample-keys/client.key > ${key}
-echo "$password" > $pwdfile
-
-# our version of grep to output log.txt on failure in case it's an openssl
-# error mismatch and the grep expression needs updating
-loggrep() {
-    egrep -q "$1" log.txt || { echo '---- begin log.txt ----'; cat log.txt; echo '--- end log.txt ---'; return 1; }
-}
-
-# note here we've induced a mismatch in the client key and the server
-# cert which openvpn should report and die.  Check that it does.  Note
-# also that this mismatch depends on openssl not openvpn, so it is
-# somewhat fragile
-${top_builddir}/src/openvpn/openvpn --cd ${top_srcdir}/sample --config sample-config-files/loopback-server --engine testengine --key ${key} --askpass $pwdfile > log.txt 2>&1
-
-# first off check we died because of a key mismatch.  If this doesn't
-# pass, suspect openssl of returning different messages and update the
-# test accordingly
-loggrep '(x509 certificate routines:(X509_check_private_key)?:key values mismatch|func\(128\):reason\(116\))' log.txt || { echo "Key mismatch not detected"; exit 1; }
-
-# now look for the engine prints (these are under our control)
-loggrep 'ENGINE: engine_init called' || { echo "Engine initialization not detected"; exit 1; }
-loggrep 'ENGINE: engine_load_key called' || { echo "Key was not loaded from engine"; exit 1; }
-loggrep "ENGINE: engine_load_key got password ${password}" || { echo "Key password was not retrieved by the engine"; exit 1; }
-exit 0
tests/unit_tests/engine-key/libtestengine.c deleted +0 -116

116 lines not on this page · raw message

tests/unit_tests/engine-key/openssl.cnf.in deleted +0 -12
deleted file mode 100644
index 5eda9fa..0000000
@@ -1,12 +0,0 @@
-HOME		= .
-openssl_conf	= openssl_init
-
-[req]
-[openssl_init]
-engines		= engines_section
-
-[engines_section]
-testengine	= testengine_section
-
-[testengine_section]
-dynamic_path	= ABSBUILDDIR/.libs/libtestengine.so

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/373?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2d353a0cea0a62f289b8c1060244df66dd7a14cb
Gerrit-Change-Number: 373
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged